<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="./asset/css/reset.css">
  <link rel="stylesheet" href="./asset/css/assess.css">
  <title>李山投资-新员工试用期满考评内容</title>
</head>

<body>
  <!-- <ul id="aside">
    <li class="selected"><a href="javascript:;" >人力资源考核</a></li>
    <li ><a href="javascript:;" id="selfLink">员工个人总结</a></li>
    <li ><a href="javascript:;" id="personalLink">绩效表现</a></li>
    <li ><a href="javascript:;" id="peerLink">同级考核</a></li>
  </ul> -->
  <div class="wrapper">
    <p class="works">
      <button id="submit" class="works__btn">提交</button>
      <button id="download" class="works__btn">导出</button>
    </p>
    <div id="pdf">
      <p class="logo">
        <img src="./asset/images/logo.png" alt="" width="210px" height="53px">
      </p>
      <form class="main">
        <h1 class="title">新员工试用期满考评内容<span class="tip">LSHR-03-D</span></h1>
        <div class="sheet">
          <div class="sheet__line clearfix">
            <div class="sheet__line__item">姓名</div>
            <div class="sheet__line__item">
              <input class="input" type="text" name="uname" placeholder="请填写姓名" id="uname">
            </div>
            <div class="sheet__line__item">岗位</div>
            <div class="sheet__line__item">
              <input class="input" type="text" name="job" placeholder="请填写岗位" id="job">
            </div>
          </div>
          <div class="sheet__content clearfix">
            <div class="sheet__content__column c1">
              <h2>
                <div class="triangle tr">
                  <span class="text">内容</span>
                </div>
                <div class="triangle bl">
                  <span class="text">项目</span>
                </div>
              </h2>
              <div class="bottom">
                <span class="vertical-text">
                  人力资源考核
                </span>
              </div>
            </div>
            <div class="sheet__content__column c2">
              <h2>要点</h2>
              <div class="sheet__content__item r1">职业道德20%</div>
              <div class="sheet__content__item r2">沟通能力20%</div>
              <div class="sheet__content__item r3">劳动纪律20%</div>
              <div class="sheet__content__item r4">适应能力10%</div>
              <div class="sheet__content__item r5"><span>服务意识和亲和能力10%</span></div>
              <div class="sheet__content__item r6">团队合作10%</div>
              <div class="sheet__content__item r7">诚实10%</div>
            </div>
            <div class="sheet__content__column c3">
              <h2>优</h2>
              <div class="sheet__content__item r1">
                <div class="top">
                  严守公司机密，保持高度警觉，严格遵守公司管理制度及掌握公司工作尺度、原则，坚决服从公司决定。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr1" type="radio" value="20" />20 </label>
                  <label>
                    <input class="radio" name="hr1" type="radio" value="18" />18 </label>
                  <label>
                    <input class="radio" name="hr1" type="radio" value="16" />16 </label>
                </div>
              </div>
              <div class="sheet__content__item r2">
                <div class="top">
                  能与同事很好的协调相处，大家对其评价高。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr2" type="radio" value="20" />20 </label>
                  <label>
                    <input class="radio" name="hr2" type="radio" value="18" />18 </label>
                  <label>
                    <input class="radio" name="hr2" type="radio" value="16" />16 </label>
                </div>
              </div>
              <div class="sheet__content__item r3">
                <div class="top">
                  出勤记录极佳，始终准时坚守工作岗位。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr3" type="radio" value="20" />20 </label>
                  <label>
                    <input class="radio" name="hr3" type="radio" value="18" />18 </label>
                  <label>
                    <input class="radio" name="hr3" type="radio" value="16" />16 </label>
                </div>
              </div>
              <div class="sheet__content__item r4">
                <div class="top">
                  适应能力很强，弹性大，轻松掌握新工作。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr4" type="radio" value="10" />10 </label>
                  <label>
                    <input class="radio" name="hr4" type="radio" value="9" />9 </label>
                </div>
              </div>
              <div class="sheet__content__item r5">
                <div class="top">
                  能够主动积极了解服务需求并提供有效服务，与客户亲和力强，不暴躁，工作差错率较少。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr5" type="radio" value="10" />10 </label>
                  <label>
                    <input class="radio" name="hr5" type="radio" value="9" />9 </label>
                </div>
              </div>
              <div class="sheet__content__item r6">
                <div class="top">
                  与别人共事时, 非常体谅和细心, 乐于助人。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr6" type="radio" value="10" />10 </label>
                  <label>
                    <input class="radio" name="hr6" type="radio" value="9" />9 </label>
                </div>
              </div>
              <div class="sheet__content__item r7">
                <div class="top">
                  能够坦诚相待、实事求是、诚实地待人处事。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr7" type="radio" value="10" />10 </label>
                  <label>
                    <input class="radio" name="hr7" type="radio" value="9" />9 </label>
                </div>
              </div>
            </div>
            <div class="sheet__content__column c4">
              <h2>良</h2>
              <div class="sheet__content__item r1">
                <div class="top">
                  能够遵守企业秘密条例，遵守公司规章制度，偶有破坏情况，理解公司的决定。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr1" type="radio" value="14" />14 </label>
                  <label>
                    <input class="radio" name="hr1" type="radio" value="12" />12 </label>
                  <label>
                    <input class="radio" name="hr1" type="radio" value="10" />10 </label>
                </div>
              </div>
              <div class="sheet__content__item r2">
                <div class="top">
                  基本能与同事协调相处，大家对其评价较高。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr2" type="radio" value="14" />14 </label>
                  <label>
                    <input class="radio" name="hr2" type="radio" value="12" />12 </label>
                  <label>
                    <input class="radio" name="hr2" type="radio" value="10" />10 </label>
                </div>
              </div>
              <div class="sheet__content__item r3">
                <div class="top">
                  很少请假、迟到、早退，基本能坚守工作岗位。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr3" type="radio" value="14" />14 </label>
                  <label>
                    <input class="radio" name="hr3" type="radio" value="12" />12 </label>
                  <label>
                    <input class="radio" name="hr3" type="radio" value="10" />10 </label>
                </div>
              </div>
              <div class="sheet__content__item r4">
                <div class="top">
                  吸收快，学习新工作轻松，基本能适应公司节奏。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr4" type="radio" value="8" />8 </label>
                  <label>
                    <input class="radio" name="hr4" type="radio" value="7" />7 </label>
                  <label>
                    <input class="radio" name="hr4" type="radio" value="6" />6 </label>
                </div>
              </div>
              <div class="sheet__content__item r5">
                <div class="top">
                  能够提供服务，亲和力一般，偶尔有不耐烦现象或偶尔出现差错。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr5" type="radio" value="8" />8 </label>
                  <label>
                    <input class="radio" name="hr5" type="radio" value="7" />7 </label>
                  <label>
                    <input class="radio" name="hr5" type="radio" value="6" />6 </label>
                </div>
              </div>
              <div class="sheet__content__item r6">
                <div class="top">
                  与别人相处融洽, 待人亲切有礼, 合作度高。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr6" type="radio" value="8" />8 </label>
                  <label>
                    <input class="radio" name="hr6" type="radio" value="7" />7 </label>
                  <label>
                    <input class="radio" name="hr6" type="radio" value="6" />6 </label>
                </div>
              </div>
              <div class="sheet__content__item r7">
                <div class="top">
                  偶有撒谎现象和不守信誉，基本上能够以诚待人。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr7" type="radio" value="8" />8 </label>
                  <label>
                    <input class="radio" name="hr7" type="radio" value="7" />7 </label>
                  <label>
                    <input class="radio" name="hr7" type="radio" value="6" />6 </label>
                </div>
              </div>
            </div>
            <div class="sheet__content__column c5">
              <h2>合格</h2>
              <div class="sheet__content__item r1">
                <div class="top">
                  对外传播公司机密和不宜外传事宜，制造同事或上下级矛盾，随意破环公司制度，不服从公司决定。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr1" type="radio" value="8" />8 </label>
                  <label>
                    <input class="radio" name="hr1" type="radio" value="6" />6 </label>
                  <label>
                    <input class="radio" name="hr1" type="radio" value="4" />4 </label>
                </div>
              </div>
              <div class="sheet__content__item r2">
                <div class="top">
                  与同事相处一般，平时与大家沟通较少，缺乏团队精神。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr2" type="radio" value="8" />8 </label>
                  <label>
                    <input class="radio" name="hr2" type="radio" value="6" />6 </label>
                  <label>
                    <input class="radio" name="hr2" type="radio" value="4" />4 </label>
                </div>
              </div>
              <div class="sheet__content__item r3">
                <div class="top">
                  偶尔请假、迟到、早退，但能事先报告。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr3" type="radio" value="8" />8 </label>
                  <label>
                    <input class="radio" name="hr3" type="radio" value="6" />6 </label>
                  <label>
                    <input class="radio" name="hr3" type="radio" value="4" />4 </label>
                </div>
              </div>
              <div class="sheet__content__item r4">
                <div class="top">
                  适应能力一般，尚需进一步了解学习。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr4" type="radio" value="5" />5 </label>
                  <label>
                    <input class="radio" name="hr4" type="radio" value="4" />4 </label>
                  <label>
                    <input class="radio" name="hr4" type="radio" value="3" />3 </label>
                </div>
              </div>
              <div class="sheet__content__item r5">
                <div class="top">
                  服务意识不够，有衙门作风，员工亲和力不足，常有不耐烦现象，工作经常出现差错。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr5" type="radio" value="5" />5 </label>
                  <label>
                    <input class="radio" name="hr5" type="radio" value="4" />4 </label>
                  <label>
                    <input class="radio" name="hr5" type="radio" value="3" />3 </label>
                </div>
              </div>
              <div class="sheet__content__item r6">
                <div class="top">
                  与别人相处, 草率依赖, 没有团队精神。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr6" type="radio" value="5" />5 </label>
                  <label>
                    <input class="radio" name="hr6" type="radio" value="4" />4 </label>
                  <label>
                    <input class="radio" name="hr6" type="radio" value="3" />3 </label>
                </div>
              </div>
              <div class="sheet__content__item r7">
                <div class="top">
                  时有不实语言，不能获得同事与上级信赖，虚假汇报，掩盖工作失误。
                </div>
                <div class="bottom">
                  <label>
                    <input class="radio" name="hr7" type="radio" value="5" />5 </label>
                  <label>
                    <input class="radio" name="hr7" type="radio" value="4" />4 </label>
                  <label>
                    <input class="radio" name="hr7" type="radio" value="3" />3 </label>
                </div>
              </div>
            </div>
          </div>
          <div class="sheet__footer">
            <p class="grade">
              综合得分：
              <span class="sumGradeSpan">
                <input class="input" type="text" id="sumGrade" readonly>分
              </span>
            </p>
            <div class="sign">
              <p class="signLabel">
                <span>签名：</span>
              </p>
              <span class="date">年</span>
              <span class="date">月</span>
              <span class="date">日</span>
            </div>
          </div>
        </div>
      </form>
    </div>
  </div>
</body>
<script src="./js/jquery-1.8.3.min.js"></script>
<script>
  var type = /type=(\w+)/gi.exec(window.location.href);
  var empid = /empid=(\w+)/gi.exec(window.location.href);
  var username = /username=([\u4E00-\u9FA5]+)/gi.exec(decodeURIComponent(window.location.href));
  var station = /station=([\u4E00-\u9FA5]+)/gi.exec(decodeURIComponent(window.location.href));
  // var baseUrl = 'http://192.168.22.45:5526/';
  // var baseUrl = 'http://192.168.3.26:5526/';
  var baseUrl = 'http://report.wsloan.com:5526/EmployeeSystem';

  if (username) {
    username = username[1];
  }

  if (station) {
    station = station[1];
  }
  if (empid) {
    empid = empid[1];
  } else {
    // 没有empid的处理
  }
  if (type) {
    type = type[1];
    if (type == 'edit') {
      editHR();
    } else if (type == 'preview') {
      $('.input,.radio,.textarea').attr('disabled', 'true');
      console.log('preview')
      $('#download').show();

      // 获取HR数据
      getHRData()
    } else {
      // 非法参数值处理
    }
  } else {
    // 没有type的处理
  }

  // 右侧导航路由

  function editHR(){
    console.log(username, station);
    $('#uname').val(username)
    $('#job').val(station)
    $('#submit').show();
    // 计算总分处理
    function sumScore() {
      var hr1 = parseInt($(".radio[name='hr1']:checked").val(), 10) || 0;
      var hr2 = parseInt($(".radio[name='hr2']:checked").val(), 10) || 0;
      var hr3 = parseInt($(".radio[name='hr3']:checked").val(), 10) || 0;
      var hr4 = parseInt($(".radio[name='hr4']:checked").val(), 10) || 0;
      var hr5 = parseInt($(".radio[name='hr5']:checked").val(), 10) || 0;
      var hr6 = parseInt($(".radio[name='hr6']:checked").val(), 10) || 0;
      var hr7 = parseInt($(".radio[name='hr7']:checked").val(), 10) || 0;
      var sum = hr1 + hr2 + hr3 + hr4 + hr5 + hr6 + hr7;

      $('#sumGrade').val(sum);
    }
    sumScore();

    $(".radio[name='hr1']," +
      ".radio[name='hr2']," +
      ".radio[name='hr3']," +
      ".radio[name='hr4']," +
      ".radio[name='hr5']," +
      ".radio[name='hr6']," +
      ".radio[name='hr7']").change(function() {
      sumScore();
    });
  }


  // 获取数据
  function getHRData(){
    $.ajax({
      url: baseUrl + 'show/hrscore.htmls',
      type:'get',
      data: {
        empid: empid
      },
      success: function(res){
        console.log('HRDATA:', res)
        var data = res.data
        if(res.code === 0 && data){
          $('#uname').val(data.username)
          $('#job').val(data.station)
          $(".radio[name='hr1']").each(function(index,hr){
            if(parseInt($(hr).val()) === data.HR1){
              $(hr).attr('checked', true)
            }
          })
          $(".radio[name='hr2']").each(function(index,hr){
            if(parseInt($(hr).val()) === data.HR2){
              $(hr).attr('checked', true)
            }
          })
          $(".radio[name='hr3']").each(function(index,hr){
            if(parseInt($(hr).val()) === data.HR3){
              $(hr).attr('checked', true)
            }
          })
          $(".radio[name='hr4']").each(function(index,hr){
            if(parseInt($(hr).val()) === data.HR4){
              $(hr).attr('checked', true)
            }
          })
          $(".radio[name='hr5']").each(function(index,hr){
            if(parseInt($(hr).val()) === data.HR5){
              $(hr).attr('checked', true)
            }
          })
          $(".radio[name='hr6']").each(function(index,hr){
            if(parseInt($(hr).val()) === data.HR6){
              $(hr).attr('checked', true)
            }
          })
          $(".radio[name='hr7']").each(function(index,hr){
            if(parseInt($(hr).val()) === data.HR7){
              $(hr).attr('checked', true)
            }
          })
          $('#sumGrade').val(data.HR1 + data.HR2 + data.HR3 + data.HR4 + data.HR5 + data.HR6 + data.HR7);
          return
        }else{
          alert(res.msg)
        }
      }
    })
  }

  // 提交
  $('#submit').on('click', function(e) {
    e.stopPropagation();
    e.preventDefault();

    var hr1 = $(".radio[name='hr1']:checked").val();
    var hr2 = $(".radio[name='hr2']:checked").val();
    var hr3 = $(".radio[name='hr3']:checked").val();
    var hr4 = $(".radio[name='hr4']:checked").val();
    var hr5 = $(".radio[name='hr5']:checked").val();
    var hr6 = $(".radio[name='hr6']:checked").val();
    var hr7 = $(".radio[name='hr7']:checked").val();

    if (!hr1 || !hr2 || !hr3 || !hr4 || !hr5 || !hr6 || !hr7) {
      alert('还有未打分的项目');
      return false;
    }
    $.ajax({
      url: baseUrl + 'insert/hrscore.htmls',
      type: 'post',
      dataType: 'json',
      data: {
        empid: empid,
        hr1: hr1,
        hr2: hr2,
        hr3: hr3,
        hr4: hr4,
        hr5: hr5,
        hr6: hr6,
        hr7: hr7
      },
      success: function(data) {
        var url = window.location.href
        if (data.code === 0) {
          alert(data.msg);
          url = url.replace(/type=edit/, 'type=preview');
          window.location.replace(url)
        }
      },
      error: function(error) {
        console.log(error);
        alert('请求失败');
      }
    });
  });
</script>
<script src="./js/jspdf.debug.js"></script>
<!-- <script src="./js/jspdf.min.js"></script> -->
<script src="./js/download.js"></script>

</html>
